package com.beici.waterghost.model.login;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Collection;

@TableName("user")
public class userLogin implements UserDetails {
    @TableField("user_id")
    private Integer userId;
    @TableField("user_email")
    private String userEmail;
    @TableField("user_phone")
    private String userPhone;
    @TableField("user_key")
    private String userKey;
    @TableField("user_lock")
    private Boolean userLock;


    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return userKey;
    }

    @Override
    public String getUsername() {
        return userPhone;
    }

    public String getUserPhone() {
        return userPhone;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return userLock;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
